.class Ldgb/a3;
.super Ljava/lang/Object;
.source "SourceFile"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Ldgb/a3$a;
    }
.end annotation


# direct methods
.method public static a(Ljava/io/InputStream;)I
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    invoke-static {p0}, Ldgb/v3;->b(Ljava/io/InputStream;)I

    move-result p0

    const v0, 0x61744951

    if-ne p0, v0, :cond_0

    return p0

    .line 2
    :cond_0
    new-instance v0, Ljava/io/IOException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "bad signature: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-static {p0}, Ljava/lang/Integer;->toHexString(I)Ljava/lang/String;

    move-result-object p0

    invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p0

    invoke-direct {v0, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public static a(Ljava/io/InputStream;JJ)V
    .locals 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 3
    invoke-static {p0}, Ldgb/a3;->a(Ljava/io/InputStream;)I

    .line 4
    invoke-static {p0}, Ldgb/v3;->b(Ljava/io/InputStream;)I

    move-result v0

    long-to-int v1, p1

    const-string v2, ", expect="

    if-ne v1, v0, :cond_2

    .line 5
    invoke-static {p0}, Ldgb/v3;->b(Ljava/io/InputStream;)I

    move-result p1

    const-wide/16 v0, 0x10

    add-long/2addr v0, p3

    int-to-long v3, p1

    cmp-long p2, v0, v3

    if-nez p2, :cond_1

    const/4 p1, 0x4

    .line 6
    invoke-static {p0, p1}, Ldgb/v3;->a(Ljava/io/InputStream;I)Ljava/lang/String;

    move-result-object p0

    const-string p1, "SSED"

    .line 7
    invoke-virtual {p0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p0

    if-eqz p0, :cond_0

    return-void

    .line 8
    :cond_0
    new-instance p0, Ljava/lang/RuntimeException;

    const-string p1, "bad magic: SSED"

    invoke-direct {p0, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw p0

    .line 9
    :cond_1
    new-instance p0, Ljava/lang/RuntimeException;

    new-instance p2, Ljava/lang/StringBuilder;

    invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v0, "bad fileSize: real="

    invoke-virtual {p2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p2, p3, p4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    invoke-virtual {p2, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p2, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {p0, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw p0

    .line 10
    :cond_2
    new-instance p0, Ljava/lang/RuntimeException;

    new-instance p3, Ljava/lang/StringBuilder;

    invoke-direct {p3}, Ljava/lang/StringBuilder;-><init>()V

    const-string p4, "bad crc: real="

    invoke-virtual {p3, p4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-static {p1, p2}, Ljava/lang/Long;->toHexString(J)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p3, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    int-to-long p1, v0

    .line 11
    invoke-static {p1, p2}, Ljava/lang/Long;->toHexString(J)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {p3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {p0, p1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw p0
.end method

.method static a([B)[B
    .locals 5

    const/4 v0, 0x0

    if-eqz p0, :cond_2

    .line 12
    array-length v1, p0

    if-nez v1, :cond_0

    goto :goto_1

    :cond_0
    const/16 v1, 0x10

    new-array v2, v1, [B

    :try_start_0
    const-string v3, "SHA1"

    .line 13
    invoke-static {v3}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

    move-result-object v3

    .line 14
    invoke-virtual {v3}, Ljava/security/MessageDigest;->reset()V

    .line 15
    invoke-virtual {v3, p0}, Ljava/security/MessageDigest;->update([B)V

    .line 16
    invoke-virtual {v3}, Ljava/security/MessageDigest;->digest()[B

    move-result-object p0

    const/4 v3, 0x0

    :goto_0
    if-ge v3, v1, :cond_1

    .line 17
    aget-byte v4, p0, v3

    aput-byte v4, v2, v3
    :try_end_0
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_0} :catch_0

    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    :cond_1
    return-object v2

    :catch_0
    :cond_2
    :goto_1
    return-object v0
.end method

.method public static b(Ljava/io/InputStream;)Ldgb/a3$a;
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Exception;
        }
    .end annotation

    const/4 v0, 0x4

    .line 1
    invoke-static {p0, v0}, Ldgb/v3;->a(Ljava/io/InputStream;I)Ljava/lang/String;

    move-result-object v0

    .line 2
    invoke-static {p0}, Ldgb/a3;->a(Ljava/io/InputStream;)I

    const-string v1, "SSBG"

    .line 3
    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 4
    invoke-static {p0}, Ldgb/v3;->c(Ljava/io/InputStream;)[B

    .line 5
    invoke-static {p0}, Ldgb/a3;->a(Ljava/io/InputStream;)I

    .line 6
    invoke-static {p0}, Ldgb/v3;->c(Ljava/io/InputStream;)[B

    move-result-object v1

    .line 7
    invoke-static {p0}, Ldgb/a3;->a(Ljava/io/InputStream;)I

    .line 8
    invoke-static {p0}, Ldgb/v3;->a(Ljava/io/InputStream;)Z

    move-result v2

    .line 9
    invoke-static {p0}, Ldgb/a3;->a(Ljava/io/InputStream;)I

    .line 10
    new-instance p0, Ldgb/a3$a;

    invoke-direct {p0}, Ldgb/a3$a;-><init>()V

    .line 11
    iput-object v0, p0, Ldgb/a3$a;->a:Ljava/lang/String;

    .line 12
    iput-object v1, p0, Ldgb/a3$a;->b:[B

    .line 13
    iput-boolean v2, p0, Ldgb/a3$a;->c:Z

    .line 14
    sget-boolean v0, Ldgb/x2;->b:Z

    if-eqz v0, :cond_0

    const-string v0, "read header done"

    .line 15
    invoke-static {v0}, Ldgb/a4;->a(Ljava/lang/String;)V

    :cond_0
    return-object p0

    .line 16
    :cond_1
    new-instance p0, Ljava/lang/RuntimeException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "bad magic: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, v0}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw p0
.end method
